package com.sakiko.dao.impl;

import com.sakiko.dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class StudentDaoImpl implements StudentDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public int updateAgeById(Integer id, Integer age) {
        String sql="update students set age = ? where id = ?";
        return jdbcTemplate.update(sql, age, id);
    }

    @Override
    public int updateGenderById(Integer id, String gender) {
        String sql ="update students set gender = ? where id = ?";
        return jdbcTemplate.update(sql, gender, id);
    }
}
